package com.tm.portal.dao;

import org.hibernate.Session;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.tm.portal.pojo.Pojo;

public class DaoSupport extends HibernateDaoSupport implements Dao
{

	@Override
	public void save(Pojo pojo)
	{
		super.getSessionFactory().openSession().saveOrUpdate(pojo);
	}

	@Override
	public void delete(Pojo pojo)
	{
		super.getSessionFactory().openSession().delete(pojo);
	}

	@SuppressWarnings("unchecked")
	@Override
	public <T extends Pojo> T get(Class<? extends Pojo> clazz, String id)
	{
		Session session = super.getSessionFactory().openSession();
		return (T) session.get(clazz, id);
	}
}
